package com.zzc.control;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import com.zzc.dao.UserDao;
import com.zzc.pojo.User;
import com.zzc.service.UserService;

@Controller
@RequestMapping("/user")
public class UserControl extends BaseControl {
	@Autowired
	public UserService us;
	@Autowired
	public UserDao ud;
	
	@RequestMapping("/login")
	public String login(@RequestParam("uname") String uname,@RequestParam("upwd") String upwd){
		Boolean result=us.login(uname, upwd);
		if(result){
			User user=ud.findByUserName(uname);
			session.setAttribute("user", user);
			return "index";
		}else{
			return "error";
		}
	}
}
